package com.shux.usermanager.biz.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shux.common.exception.ShuxRunTimeException;
import com.shux.usermanager.biz.ISysButtonPermissionBiz;
import com.shux.usermanager.dao.ISysButtonPermissionDao;
import com.shux.usermanager.entity.SysButtonPermission;

/**
 **********************************************
 *  描述：
 * Simba.Hua
 * 2017年6月19日
 **********************************************
**/
@Service("sysButtonPermissionBiz")
public class SysButtonPermissionBizImpl implements ISysButtonPermissionBiz {
    private Logger logger = LoggerFactory.getLogger(getClass());
    private @Autowired ISysButtonPermissionDao sysButtonPermissionDao;
    @Override
    public List<SysButtonPermission> queryAll() {
        // TODO Auto-generated method stub
        try {
            return sysButtonPermissionDao.queryAll();
        } catch (Exception e) {
            logger.error("查询全部按钮权限失败!",e);
            throw new ShuxRunTimeException("查询全部按钮权限失败!",e);
        }
    }
    @Override
    public List<SysButtonPermission> queryButtonByRole(String roleId) {
        // TODO Auto-generated method stub
        try {
            return sysButtonPermissionDao.queryButtonByRole(roleId);
        } catch (Exception e) {
            logger.error("通过角色ID查询按钮权限失败!",e);
            throw new ShuxRunTimeException("通过角色ID查询按钮权限失败!",e);
        }
    }

}
